package com.ishansong.ticket.service;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 
 * @author hongtaozhang
 * 
 */
public class OrderServer {

	private static ClassPathXmlApplicationContext context;

	/**
	 * 启动服务
	 * @throws InterruptedException
	 */
	public void run() throws InterruptedException {

		Runtime.getRuntime().addShutdownHook(new Thread() {

			// add hook here

		});

		context = new ClassPathXmlApplicationContext(new String[] { "classpath:application-service.xml" ,"classpath:application-context.xml"});
		context.start();

		while (true) {
			Thread.sleep(Long.MAX_VALUE);
		}
	}

	public static void main(String[] args) throws Exception {

	 	OrderServer server = new OrderServer();
		try {
			server.run();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.print("Order Server Start!");
		// mvn exec:java -Dexec.mainClass="com.ishansong.ticket.service.Main"
	}

}
